/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jp.co.irep.juten.entity;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author toan_nguyen
 */
@Entity
@Table(name = "maker_prefecture")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MakerPrefecture.findAll", query = "SELECT m FROM MakerPrefecture m"),
    @NamedQuery(name = "MakerPrefecture.findByMakerId", query = "SELECT m FROM MakerPrefecture m WHERE m.makerPrefecturePK.makerId = :makerId"),
    @NamedQuery(name = "MakerPrefecture.findByPrefectureId", query = "SELECT m FROM MakerPrefecture m WHERE m.makerPrefecturePK.prefectureId = :prefectureId")})
public class MakerPrefecture implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected MakerPrefecturePK makerPrefecturePK;

    public MakerPrefecture() {
    }

    public MakerPrefecture(MakerPrefecturePK makerPrefecturePK) {
        this.makerPrefecturePK = makerPrefecturePK;
    }

    public MakerPrefecture(int makerId, int prefectureId) {
        this.makerPrefecturePK = new MakerPrefecturePK(makerId, prefectureId);
    }

    public MakerPrefecturePK getMakerPrefecturePK() {
        return makerPrefecturePK;
    }

    public void setMakerPrefecturePK(MakerPrefecturePK makerPrefecturePK) {
        this.makerPrefecturePK = makerPrefecturePK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (makerPrefecturePK != null ? makerPrefecturePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MakerPrefecture)) {
            return false;
        }
        MakerPrefecture other = (MakerPrefecture) object;
        if ((this.makerPrefecturePK == null && other.makerPrefecturePK != null) || (this.makerPrefecturePK != null && !this.makerPrefecturePK.equals(other.makerPrefecturePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jp.co.irep.tech.juten.jpa.entity.MakerPrefecture[ makerPrefecturePK=" + makerPrefecturePK + " ]";
    }
    
}
